/**
 * Created by dukes on 2016/3/2.
 */
class GuildInfo extends eui.Component {
    public constructor() {
        super();
        this.skinName = "skins.scene.GuildInfoSkin";
        // this.addEventListener(egret.Event.ADDED_TO_STAGE,this.onAdded, this );
        // this.addEventListener(egret.Event.REMOVED_FROM_STAGE, this.onRemoved, this);
    }

    // public onDonate(evt:egret.TouchEvent){
    //     GuildDonatePanel.getInstance().show();
    // }

    // public onNoticeEdit(evt:egret.TouchEvent){
    //     if( GuildMgr.getInstance().guildInfo.shaikhId != Model.me.id){
    //         ShowHint("您不是族长");
    //         return;
    //     }
    //     EditPanel.getInstance().showContent(GuildMgr.getInstance().guildInfo.notice,this, this.sendNoticeEdit);
    // }

    // public sendNoticeEdit(msg:string){
    //     window["__notice"](msg);
    // }
    // public sendMessageEdit(msg:string){
    //     window["__message"](msg);
    // }
    // public onMsgEdit(evt:egret.TouchEvent){
    //     EditPanel.getInstance().showContent("",this, this.sendMessageEdit);
    // }

    // public onMsgClean(evt:egret.TouchEvent){
    //     window["__clearBoard"]();
    // }

    // private updateScrollPosition(){
    //     this.label_notice_1.commitProperties();
    //     this.label_notice_1.height = this.label_notice_1._textField.textHeight;
    //     this.messageGroup.setContentSize(399,this.label_notice_1.height);
    //     var sv = this.label_notice_1.height - 150;
    //     if( sv > 0){
    //         this.messageGroup.verticalScrollPosition = sv;
    //         this.scroller._updateContentPosition();
    //     }
    // }
    // public addMessage(data){
    //     var msg =  this.label_notice_1.text;
    //     msg+="\r【"+LimitStringLen(data.userName)+"】："+data.content;
    //     this.label_notice_1.text =  msg;
    //     egret.setTimeout(this.updateScrollPosition,this,500);
    // }
    // public updateMessga(messages){
    //     var len = messages.length;
    //     var data;
    //     var guildMsgString = "";
    //     while(len > 0){
    //         data = messages[len - 1];
    //         if( guildMsgString){
    //             guildMsgString += "\r【"+LimitStringLen(data.userName)+"】："+data.content;
    //         }else{
    //             guildMsgString = "【"+LimitStringLen(data.userName)+"】："+data.content;
    //         }
    //         len--;
    //     }

    //     this.label_notice_1.text = guildMsgString;
    //     egret.setTimeout(this.updateScrollPosition,this,500);
    // }

    // public onNoticeEditBack(){
    //     this.lab_notice_0.text = GuildMgr.getInstance().guildInfo.notice;
    // }

    // private onAdded(evt:egret.Event){
    //     this.img_donate.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onDonate, this);
    //     this.img_notice_edit.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onNoticeEdit, this);
    //     this.img_msg_clean.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onMsgClean, this);
    //     this.img_msg_edit.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onMsgEdit, this);
    //     this.updateDisplay();
    //     window["__hall"]();
    // }
    // private onRemoved(evt:egret.Event){
    //     this.img_donate.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onDonate, this);
    //     this.img_notice_edit.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onNoticeEdit, this);
    //     this.img_msg_clean.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onMsgClean, this);
    //     this.img_msg_edit.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onMsgEdit, this);
    // }
    // public updateDisplay(){
    //     var info =  GuildMgr.getInstance().guildInfo;
    //     if(info){
    //         this.lab_name.text = "家族名称: "+info.name;
    //         this.lab_cnt.text = "成员: "+info.currMemberCount+"/"+info.maxMemberCount;
    //         this.lab_point.text = "威望: "+GetNumString(info.prestige,false,true);
    //         this.lab_lv.text = "等级: "+info.level;
    //         this.lab_id.text = "ID: "+info.id;
    //         this.lab_notice_0.text = info.notice.length != 0 ? info.notice :"族长很懒，什么都没留下";;

    //         this.img_notice_edit.visible = info.shaikhId == Model.me.id;
    //         this.img_msg_clean.visible = info.shaikhId == Model.me.id;
    //     }else{
    //         SceneMgr.getInstance().switchScene(SceneMgr.SCENE_GUILD_LIST);
    //     }
    // }
    // public lab_name:eui.Label;
    // private lab_cnt:eui.Label;
    // private lab_point:eui.Label;
    // public lab_lv:eui.Label;
    // private lab_id:eui.Label;
    // public lab_notice_0:eui.Label;
    // private label_notice_1:eui.Label;
    // private img_donate:eui.Image;
    // private img_notice_edit:eui.Image;
    // private img_msg_clean:eui.Image;
    // private img_msg_edit:eui.Image;
    // private scroller:eui.Scroller;
    // private messageGroup:eui.Group;
    // public partAdded(name:string, instance:any) {
    //     super.partAdded(name, instance);
    //     if (name == "lab_name") {
    //         this.lab_name = instance;
    //     } else if (name == "lab_cnt") {
    //         this.lab_cnt = instance;
    //     }else if (name == "lab_point") {
    //         this.lab_point = instance;
    //     }else if (name == "lab_lv") {
    //         this.lab_lv = instance;
    //     }else if (name == "lab_id") {
    //         this.lab_id = instance;
    //     }else if (name == "lab_notice_0") {
    //         this.lab_notice_0 = instance;
    //         this.lab_notice_0._textField.touchEnabled = true;
    //     }else if (name == "label_notice_1") {
    //         this.label_notice_1 = instance;
    //     }else if (name == "img_donate") {
    //         this.img_donate = instance;
    //     }else if (name == "img_notice_edit") {
    //         this.img_notice_edit = instance;
    //     }else if (name == "img_msg_clean") {
    //         this.img_msg_clean = instance;
    //     }else if (name == "img_msg_edit") {
    //         this.img_msg_edit = instance;
    //     }else if (name == "scroller") {
    //         this.scroller = instance;
    //     }else if (name == "messageGroup") {
    //         this.messageGroup = instance;
    //     }
    // }
    private static _instance:GuildInfo;
    public static getInstance():GuildInfo{
        if( GuildInfo._instance == null)
            GuildInfo._instance = new GuildInfo();
        return GuildInfo._instance;
    }
}